
#include <stdio.h>


// #include "board.h"


#pragma pack (16)
#define TByte(var) unsigned char var __attribute__((aligned(0x100)))

struct test
{
	int a;
	int b;
	int c;
	int d;
	int e;
};

long *mreturn(long *, long, long);

void app_test()
{

}

long msve(long, long);

void sve_reg();

// int _read_sys_reg(long *rs);

// #define READ_SYS_REG(rs, NAME) __asm__ __volatile__( \
//  "mrs %1, " #NAME"" \
//  :1"=r"(rs) \
// )
#define READ_SYS_REG(rs, NAME) asm("mrs %0, "#NAME :"=r"(rs)); \
					 printf("REG: "#NAME); printf(", rs:%lx\n", rs)

void read_sys_reg()
{
	unsigned long rs=0;
	READ_SYS_REG(rs, cptr_el2);
	READ_SYS_REG(rs, cptr_el3);
}

int main()
{
#ifdef BOARD_FVP_AEM_BASE
	UartInit();
#endif
	// version_print();

	printf("hello world\n");
	
	read_sys_reg();

	int i = 0;
	long l1 = 3;
	long l2 = 4;
	long u = msum(l1, l2);

	long tr[2] __attribute__((aligned(0x10))) = {0, 0};
	long *tp = mreturn(tr, 3, 5);

	TByte(t_test[33]);

	struct test tl;
	printf("sizeof: %d, p:%p\n", sizeof(tl), &tl);
	printf("t_test byte p:%p\n", t_test);
	printf("point:%p\n", tp);

	sve_reg();

	u = msve(2, 3);
	printf("msve rs: 2+3=%ld\n", u);

	while (1);
	return 0;
}